package org.metasketch.demo.perspectives;

import org.metasketch.demo.diagrams.ATD.ATDDiagram;
import org.metasketch.demo.diagrams.OFD.OFDDiagram;
import org.metasketch.demo.diagrams.PSD.PSDDiagram;
import org.metasketch.demo.diagrams.TT.TTDiagram;
import org.metasketch.demo.model.ActorRole;
import org.metasketch.demo.model.CoordinationStep;
import org.metasketch.demo.model.ProductionStep;
import org.metasketch.demo.model.TransactionKind;
import org.metasketch.demo.model.TransactionStep;
import org.metasketch.editor.perspectives.BaseDiagrammaticPerspective;
import org.metasketch.editor.perspectives.BaseLayout;
import org.metasketch.editor.perspectives.MultipleProjectBaseLayout;
import org.metasketch.editor.perspectives.Perspective;
import org.metasketch.editor.project.ProjectType;

public class DEMOPerspective extends BaseDiagrammaticPerspective {

	public DEMOPerspective() {
		super("DEMO Modeling");

		// layout = new BaseLayout(this);
		layout = new MultipleProjectBaseLayout(this, ProjectType.DEMO);

		diagramTypeManager.register(new ATDDiagram());
		diagramTypeManager.register(new TTDiagram());
		diagramTypeManager.register(new OFDDiagram());

		diagramTypeManager.register(new PSDDiagram());

		String testScript = "import org.metasketch.demo.model.*; if(semantic.kind == CoordinationStepKind.Request || semantic.kind == CoordinationStepKind.Promise || semantic.kind == CoordinationStepKind.State || semantic.kind == CoordinationStepKind.Accept) return false; else return true;";

		modelViewerScripts.registerDeleteTest(CoordinationStep.class,
				testScript);

		modelViewerScripts.registerDeleteTest(ProductionStep.class,
				"return false;");

		modelViewerScripts
				.registerInheritedLabel(CoordinationStep.class,
						"return \"Coord - \" + semantic.kind.toString() + \" - \" + semantic.id;");
		// modelViewerScripts.registerLabel(ActorRole.class, "return ");
		modelViewerScripts
				.registerLabel(TransactionKind.class,
						"return \"Transaction - \" + semantic.identifier + \" - \" + semantic.id; ");
		modelViewerScripts.registerLabel(ProductionStep.class,
				"return \"Production \"+ \" - \" + semantic.id; ");

		// layout = new

	}

}
